import { request } from 'umi';

/**
 * 创建所有预览窗口
 * @param server
 * @param outputSourceName 输出源进程名称
 */
export const create = (server: string, outputSourceName: string) => {
  return request(`${server}/preview/create`, {
    params: { outputSourceName },
  });
};

/**
 * 销毁所有预览窗口
 * @param server
 * @param outputSourceName 输出源进程名称
 */
export const destroy = (server: string, outputSourceName: string) => {
  return request(`${server}/preview/destroy`, {
    params: { outputSourceName },
  });
};

/**
 * 创建所有预览窗口
 * @param server
 * @param workerName 源进程名称
 */
export const setActive = (server: string, workerName: string) => {
  return request(`${server}/preview/active`, {
    params: { workerName },
  });
};
/**
 * 创建所有预览窗口
 * @param server
 */
export const getActive = (server: string) => {
  return request(`${server}/preview/getActive`);
};
